const db = uniCloud.database()
const dbCmd = db.command
module.exports = {
	_before: function() { // 通用预处理器

	},
	async deleteFile(fileList) {
		if (!fileList) return { errCode: -1, errMsg: '缺少文件ID参数' }
		let res = await uniCloud.deleteFile({
			fileList: typeof fileList == 'string' ? [fileList] : fileList
		})
		return res
	},
	async deleteOrder(ids, schemaName) {
		if (!ids) return { errCode: -1, errMsg: '缺少ids参数' }
		if (!schemaName) return { errCode: -1, errMsg: '缺少schemaName参数' }
		const res = await db.collection(schemaName)
			.where({
				_id: dbCmd.in(ids)
			})
			.remove();
		return res
	}
}